<?php
$this->pageTitle = 'My Account';
CHtml::$afterRequiredLabel = '';

$timezones = DateTimeZone::listIdentifiers();
$data = array();
for($i = 0, $length = count($timezones) - 1; $i < $length;) {
    $timezone = $timezones[$i];
    $continent = substr($timezone, 0, strpos($timezone, '/'));
    $countries = array();

    while(true) {
	$timezone = $timezones[$i];
	$currentContinent = substr($timezone, 0, strpos($timezone, '/'));
	if($currentContinent === $continent) {
	    $countries[$timezone] = substr($timezone, strpos($timezone, '/') + 1);
	    $i++;
	} else {
	    break;
	}
    }

    $data[$continent] = $countries;
}
?>

<h1><?php echo Yii::app()->user->name; ?>'s Account</h1>

<?php
$form = $this->beginWidget('CActiveForm', array(
    'errorMessageCssClass' => 'alert-text',
    'enableClientValidation' => false,
    ));
?>

<div class="form-row">
    <?php
    echo $form->labelEx($model, 'name');
    echo $form->textField($model, 'name', array(
	'placeholder' => 'Name',
	'maxlength' => 64,
	'required' => ''
    ));
    echo $form->error($model, 'name');
    ?>
</div>

<div class="form-row">
    <?php
    echo $form->labelEx($model, 'timezone');
    echo $form->dropDownList($model, 'timezone', $data);
    echo $form->error($model, 'timezone');
    ?>
</div>

<div class="form-row">
    <?php
    echo CHtml::submitButton('Update Account', array(
	'class' => 'action'
    ));
    ?>
</div>

<?php $this->endWidget(); ?>